<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCommentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('comments', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('customer_id')->comment('顾客ID');
            $table->integer('product_id')->comment('商品ID');
            $table->string('content')->default("")->comment('内容详情');
            $table->string('score')->default(5)->comment('评分');
            $table->tinyInteger('level')->default(0)->comment('评分等级: 0 好评；1 差评');
            $table->tinyInteger('has_images')->default(0)->comment('是否有图');
            $table->string('detail')->comment('商品详情');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('comments');
    }
}
